package com.one.common.common.order;

import com.one.common.utils.StringUtils;

/**
 * author ：zhulunjun
 * email  ：zhulunjun@qq.com
 * date   ：2018/8/9 下午11:50
 * description ：
 **/
public class AddMaterialItem extends MaterialItem{
    private boolean isFree;
    private double totalPrice; // 总金额
    private int type;//0 为费用 1为优惠券立减 2 为应付总金额

    public AddMaterialItem(boolean isFree) {
        this.isFree = isFree;
    }

    public AddMaterialItem(double totalPrice) {
        this.totalPrice = totalPrice;
    }

    public AddMaterialItem(MaterialItem item, boolean isFree) {
        setMaterial_id(item.getMaterial_id());
        setMaterial_count(item.getMaterial_count());
        setMaterial_name(item.getMaterial_name());
        setOrder_id(item.getOrder_id());
        setOrder_material_id(item.getOrder_material_id());
        setPrice(item.getMaterial_price());
        this.isFree = isFree;
    }


    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(int totalPrice) {
        this.totalPrice = totalPrice;
    }

    public double getNum() {
        return StringUtils.getDoubleToString(getMaterial_count());
    }

    public void setNum(String num) {
         setMaterial_count(num);
    }

    public boolean isFree() {
        return isFree;
    }

    public void setFree(boolean free) {
        isFree = free;
    }
}
